import axios from 'axios';

interface PredictionResponse {
    status: string;
    requested_days: number;
    predicted_days: number;
    predictions: {
        [date: string]: number;
    };
}

export async function fetchTemperaturePredictions(
    days: number = 7,
    target: 'guilin_max' | 'guilin_min' = 'guilin_max'
): Promise<PredictionResponse> {
    try {
        const response = await axios.get(`/api/predict_ensemble`, {
            params: {
                days,
                target
            }
        });
        return response.data;
    } catch (error) {
        console.error('获取温度预测数据失败', error);
        throw error;
    }
}